package com.demo2do.dubbo.client;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.demo2do.dubbo.protocol.entity.ProductCategory;
import com.demo2do.dubbo.protocol.service.DemoService;

/**
 * Hello world!
 *
 */
public class DubboConsumer {
    
    /**
     * @param args
     * @throws Exception
     */
    @SuppressWarnings("resource")
    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("consumer.xml");
        ctx.start();
        
        DemoService demoService = (DemoService) ctx.getBean("demoService");
        
        ProductCategory category = new ProductCategory();
        category.setProductNo("AAA");
        category.setServiceMonth(24);
        category.setDescription("测试");
        
        String hello = demoService.sayHello("World");
        demoService.createProductCategory(category);
        
        System.out.println(hello);
    }
}
